﻿using System.Web;

namespace Sex
{
    public partial class Sex : System.Web.UI.Page
    {
        public class ListResponse : MyList
        {
            HttpResponse r;

            string GetCookies()
            {
                string cookies = "";
                HttpCookieCollection cc = r.Cookies;
                cookies = "Count:" + cc.Count + "<br/>";
                foreach (string c in cc)
                {
                    cookies += FormatMyKey(c) + FormatMyText("=") + cc[c] + "<br/>";
                }
                return cookies;
            }
            public ListResponse(State MyState)
                : base(MyState, "Response Object")
            {
                HttpContext myHttpContext = HttpContext.Current;
                r = myHttpContext.Response;

                Add("Response.Cache", strComplexType);
                Add("Response.CacheControl", r.CacheControl);
                Add("Response.Charset", r.Charset);
                Add("Response.ContentEncoding", r.ContentEncoding.ToString());
                Add("Response.ContentType", r.ContentType);
                Add("Response.Cookies", GetCookies());
                Add("Response.Expires (min)", r.Expires.ToString());
                Add("Response.ExpiresAbsolute", r.ExpiresAbsolute.ToString());
                try
                {
                    Add("Response.Headers", GetNameValueCollection(r.Headers));
                }
                catch
                {
                    Add("Response.Headers", strNotAvailable);
                }
                try
                {
                    Add("Response.HeaderEncoding", r.HeaderEncoding.ToString());
                }
                catch
                {
                    Add("Response.HeaderEncoding", strNotAvailable);
                }
                Add("Response.IsClientConnected", r.IsClientConnected.ToString());
                Add("Response.IsRequestBeingRedirected", r.IsRequestBeingRedirected.ToString());
                Add("Response.RedirectLocation", r.RedirectLocation);
                Add("Response.Status", r.Status);
                try
                {
                    Add("Response.StatusCode", r.StatusCode.ToString());
                }
                catch
                {
                    Add("Response.StatusCode", strNotAvailable);
                }
                Add("Response.StatusDescription", r.StatusDescription);
                try
                {
                    Add("Response.SubStatusCode", r.SubStatusCode.ToString());
                }
                catch
                {
                    Add("Response.SubStatusCode", strNotAvailable);
                }
                Add("Response.SuppressContent", r.SuppressContent.ToString());
                Add("Response.TrySkipIisCustomErrors", r.TrySkipIisCustomErrors.ToString());
            }
        }
    }
}